//
//  ViewController.m
//  NetWorking
//
//  Created by 红军张 on 2018/7/5.
//  Copyright © 2018年 红军张. All rights reserved.
//

#import "ViewController.h"
#import "ZHJNetWorkHelper.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark -- 开始
- (IBAction)starfuntion:(id)sender {
//    如果地址是 另一个域名
    ZHJRequestConfig *config = [ZHJRequestConfig sharedRequestWithMethodType:RequestMethod_Get withPath:@"/data/sk/101010100.html" withParam:nil];
    config.isCache = NO;
    
    [[ZHJNetWorkHelper defaultManager] sendRequestMethod:config progress:nil success:^(BOOL isSuccess, id  _Nullable responseObject) {
        NSLog(@"成功");
    } failure:^(NSString * _Nullable errorMessage) {
        NSLog(@"失败 __%@",errorMessage);
    }];
}

#pragma mark -- 暂停
- (IBAction)suspended:(id)sender {
//    [ZHJNetworkManager downloadWithURL:@"https://nj01ct01.baidupcs.com/file/40c4e2ee31ebd08c7f789a559e89ae1e?bkt=p3-000031aae1e35d7e921f5e47edb335f334ee&fid=437179194-250528-215122956306326&time=1531206898&sign=FDTAXGERLQBHSK-DCb740ccc5511e5e8fedcff06b081203-ubwxfNk06kWemt6ghainq3%2BqgmQ%3D&to=63&size=4581461&sta_dx=4581461&sta_cs=3&sta_ft=jpg&sta_ct=7&sta_mt=7&fm2=MH%2CYangquan%2CAnywhere%2C%2Czhejiang%2Cct&vuk=437179194&iv=0&newver=1&newfm=1&secfm=1&flow_ver=3&pkey=000031aae1e35d7e921f5e47edb335f334ee&sl=76480590&expires=8h&rt=sh&r=539953372&mlogid=4421372850817998428&vbdid=1044503080&fin=IMG_20160227_160122.jpg&rtype=1&dp-logid=4421372850817998428&dp-callid=0.1.1&hps=1&tsl=80&csl=80&csign=3y%2F3kybPnkES6vmDmG%2BC2k8seag%3D&so=0&ut=6&uter=4&serv=0&uc=4118101883&ic=819182559&ti=548236dbf16cf8fa8768ecb19cf206d115750e4beea7a753&by=themis" fileDir:@"ZHJDownload" progress:^(NSProgress *progress) {
//        NSLog(@"下载进度:%.2f%%",100.0*progress.completedUnitCount/progress.totalUnitCount);
//        self.progreaa.progress = progress.completedUnitCount/progress.totalUnitCount;
//    } success:^(NSString *url) {
//        NSLog(@"下载路径 %@",url);
//    } failure:^(NSString * _Nullable error) {
//        NSLog(@"下载 失败 %@",error);
//    }];
}

#pragma mark -- 取消
- (IBAction)cancelFuntion:(id)sender {
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
